<html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <title>微信扫码支付</title>
</head>
<body>
<div class=out_div>
    <div class=inner_div>
        <div class=middle>
            <div class=qr id="qr">
                {$result}
            </div>
        </div>
        <div class=bottom id="title">请使用微信扫描以上二维码完成支付</div>
        <div class=sum></div>
    </div>
    <input type="hidden" id="id" value="{$id}">
</div>
</body>
</html>
<style>
    *{margin:0px;padding:0px;  font-weight:bold;}
    .inner_div{text-align:center; margin:auto; overflow:hidden; }
    .top{ border-bottom:2px  #CCCCCC solid; padding-bottom:20px;}
    .top .logo{ padding-top:10px; display:inline-block; width:50%; overflow:hidden;text-align:left;}
    .top .logo img{ height:100px; border:none;}
    .top .return{ display:inline-block; width:45%; overflow:hidden; text-align:right; line-height:100px; padding-right:3%; font-size:24px; color:#F00; text-decoration:none;}
    .top .return:hover{ color:#000;}
    .middle{ text-align:center;}
    .middle .title{ font-size:24px; line-height:80px;}
    .middle .qr{ }
    .middle .qr img{ width:200px;}
    .bottom{ line-height:100px; text-align:center; font-size:24px;}
    .sum{display:none;}
</style>
<script type="text/javascript" src="__STATIC__/admin/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/layer/layer.js"></script>
<script>
    var t1 ;
    var sum=0;
    $(document).ready(function(){
        function update_native_state(){
            sum++;
            if(sum>600){window.clearInterval(t1);return false;}
            if(sum>180){
                m=sum % 10;
                if(m!=0){return false;}
            }
            var id = $("#id").val();
            $.ajax({
                type: "get",
                async: false,
                url: "{:url('Wxpay/queryBuyState')}",
                dataType: "json",//数据类型为jsonp
                data: {'id':id},
                success: function (data) {
                    if(data.status==2){
                        window.clearInterval(t1);
                        $("#qr img").attr({"src":"__STATIC__/admin/images/wexin.png","style":"width:270px;height:90px"});
                        $("#title1").html('');
                        $("#title").html('支付成功');
                        layer.msg('支付成功', {icon: 6}, function () {
                            window.parent.location.reload();
                        });
                    }
                }
            });
        }
        t1 = window.setInterval(update_native_state,3000);
    })
</script>
</html>